﻿<%@ Page Language="C#" MasterPageFile="~/Web.master" AutoEventWireup="true" CodeBehind="Tab.aspx.cs"
  Inherits="XFSale.Aux.TabPage" %>

<asp:Content ID="partMain" ContentPlaceHolderID="partMain" runat="server">
  <asp:SqlDataSource ID="dsTab" runat="server" ConnectionString="<%$ ConnectionStrings:txfund %>"
    ProviderName="<%$ ConnectionStrings:txfund.ProviderName %>" SelectCommand="select * from XmTab where upper(tabName) like :tabName order by tabClass, tabOrder, tabName"
    UpdateCommand="update XmTab set tabDesc=:tabDesc, tabClass=:tabClass, tabOrder=:tabOrder, tabClone=:tabClone, summary=:summary where tabName=:tabName"
    InsertCommand="insert into XmTab(tabName, tabDesc, tabClass, tabOrder, tabClone, summary) values(:tabName, :tabDesc, :tabClass, :tabOrder, :tabClone, :summary)"
    DeleteCommand="delete from XmTab where tabName=:tabName"></asp:SqlDataSource>
  <asp:SqlDataSource ID="dsTabTemp" runat="server" ConnectionString="<%$ ConnectionStrings:txfund %>"
    ProviderName="<%$ ConnectionStrings:txfund.ProviderName %>"></asp:SqlDataSource>
  <table runat="server" id="pnlSearch" width="100%" class="search">
    <tr>
      <td>
        数据表名称
        <asp:TextBox runat="server" ID="txtTabName" Columns="20" ValidationGroup="Search" />
        <asp:ImageButton runat="server" ID="btnSearch" ToolTip="检索" ValidationGroup="Search"
          ImageUrl="~/image/icon_funtion.gif" ImageAlign="AbsMiddle" OnClick="btnSearch_Click" />
      </td>
      <td align="right" valign="middle">
        <asp:ImageButton runat="server" ID="btnInsert" ToolTip="新增" ValidationGroup="Action"
          ImageUrl="~/image/add.png" ImageAlign="AbsMiddle" OnClick="btnInsert_Click" />
      </td>
    </tr>
  </table>
  <asp:GridView ID="gvTab" runat="server" DataSourceID="dsTab" PageSize="15" AllowPaging="True"
    AllowSorting="True" AutoGenerateColumns="False" Width="100%" BackColor="White"
    BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1" CellPadding="3" DataKeyNames="tabName"
    ForeColor="Black" GridLines="None" OnRowCommand="gvTab_RowCommand" OnRowDataBound="gvTab_RowDataBound"
    OnSelectedIndexChanging="gvTab_SelectedIndexChanging" OnSelectedIndexChanged="gvTab_SelectedIndexChanged"
    OnRowEditing="gvTab_RowEditing" OnRowUpdating="gvTab_RowUpdating" OnRowUpdated="gvTab_RowUpdated"
    OnRowDeleting="gvTab_RowDeleting" OnRowDeleted="gvTab_RowDeleted">
    <FooterStyle BackColor="#CCCC99" />
    <RowStyle BackColor="#F7F7DE" />
    <Columns>
      <asp:BoundField DataField="TabName" ReadOnly="True" HeaderText="名称" SortExpression="TabName"
        ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" />
      <asp:BoundField DataField="TabDesc" HeaderText="描述" ItemStyle-HorizontalAlign="Left"
        HeaderStyle-HorizontalAlign="Left" />
      <asp:BoundField DataField="TabClass" HeaderText="分类" SortExpression="TabClass" ItemStyle-HorizontalAlign="Left"
        HeaderStyle-HorizontalAlign="Left" />
      <asp:BoundField DataField="TabOrder" HeaderText="顺序" ItemStyle-HorizontalAlign="Left"
        HeaderStyle-HorizontalAlign="Left" />
      <asp:BoundField DataField="TabClone" HeaderText="克隆" ItemStyle-HorizontalAlign="Left"
        HeaderStyle-HorizontalAlign="Left" />
      <asp:TemplateField HeaderText="操作">
        <ItemStyle HorizontalAlign="Right" />
        <HeaderStyle HorizontalAlign="Right" />
        <ItemTemplate>
          <asp:ImageButton ID="btnSelect" runat="server" ToolTip="设定" ImageUrl="~/image/gb.gif"
            CommandName="Select" CssClass="button3" />
          <asp:ImageButton ID="btnEdit" runat="server" ImageUrl="~/image/btn_edit.gif" CommandName="Edit"
            CssClass="button3" />
          <asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/image/btn_delete2.gif"
            CommandName="Delete" CssClass="button3" OnClientClick="return confirm('确定删除此数据表？');" />
        </ItemTemplate>
      </asp:TemplateField>
    </Columns>
    <PagerSettings Mode="NumericFirstLast" PageButtonCount="10" />
    <PagerStyle HorizontalAlign="Right" CssClass="pager" />
    <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
    <AlternatingRowStyle BackColor="White" />
  </asp:GridView>
  <asp:FormView ID="fvTab" runat="server" DataSourceID="dsTab" DefaultMode="Edit" Width="100%"
    Visible="False" DataKeyNames="TabName" OnItemInserted="fvTab_ItemInserted" OnItemUpdated="fvTab_ItemUpdated"
    OnItemCommand="fvTab_ItemCommand" OnPreRender="fvTab_PreRender" OnItemInserting="fvTab_ItemInserting"
    OnItemUpdating="fvTab_ItemUpdating">
    <EditItemTemplate>
      <table>
        <tr>
          <td>
            数据表名称：
          </td>
          <td>
            <asp:TextBox ID="txtTabName" runat="server" Text='<%# Bind("tabName") %>' Columns="30" />
            <span class="required">*</span>
            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtTabName" ErrorMessage="数据表名称必须填写"
              EnableClientScript="true" Display="Dynamic" />
            <asp:RegularExpressionValidator runat="server" ControlToValidate="txtTabName" ValidationExpression="^\w{1,30}$"
              ErrorMessage="数据表名称不合法" EnableClientScript="true" Display="Dynamic" />
          </td>
        </tr>
        <tr>
          <td>
            数据表描述：
          </td>
          <td>
            <asp:TextBox ID="txtTabDesc" runat="server" Text='<%# Bind("tabDesc") %>' Columns="30" />
            <span class="required">*</span>
            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtTabDesc" ErrorMessage="数据表描述必须填写"
              EnableClientScript="true" Display="Dynamic" />
          </td>
        </tr>
        <tr>
          <td>
            数据表分类：
          </td>
          <td>
            <asp:TextBox ID="txtTabClass" runat="server" Text='<%# Bind("tabClass") %>' Columns="30" />
            <span class="required">*</span>
            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtTabClass" ErrorMessage="数据表分类必须填写"
              EnableClientScript="true" Display="Dynamic" />
          </td>
        </tr>
        <tr>
          <td>
            数据表顺序：
          </td>
          <td>
            <asp:TextBox ID="txtTabOrder" runat="server" Text='<%# Bind("tabOrder") %>' Columns="5" />
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtTabOrder"
              ValidationExpression="^\d{1,4}$" ErrorMessage="数据表顺序不合法" EnableClientScript="true"
              Display="Dynamic" />
          </td>
        </tr>
        <tr>
          <td>
            数据表克隆：
          </td>
          <td>
            <asp:TextBox ID="txtTabClone" runat="server" Text='<%# Bind("tabClone") %>' Columns="45" />
          </td>
        </tr>
        <tr>
          <td>
            备注：
          </td>
          <td>
            <asp:TextBox ID="txtSummary" runat="server" TextMode="MultiLine" Text='<%# Bind("summary") %>'
              Columns="45" Rows="3" />
          </td>
        </tr>
      </table>
      <asp:Button ID="btnInsert" runat="server" CausesValidation="True" CommandName="Insert"
        Text="新增" CssClass="button" />
      <asp:Button ID="btnUpdate" runat="server" CausesValidation="True" CommandName="Update"
        Text="更新" CssClass="button" />
      <asp:Button ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel"
        Text="取消" CssClass="button" />
    </EditItemTemplate>
  </asp:FormView>
</asp:Content>
